//package com.sharecode.stock.controller;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.sharecode.stock.service.StockCodeService;
//import com.sharecode.stock.service.StockDateConfigService;
//import com.sharecode.stock.service.StockHistoryService;
//import com.sharecode.stock.vo.stock.StockCode;
//
//import lombok.extern.slf4j.Slf4j;
//
//@RestController
//@Slf4j
//public class DataController {
//	@Autowired
//	private StockCodeService stockCodeService;
//	@Autowired
//	private StockHistoryService stockHistoryService;
// 
//	@RequestMapping("/init")
//	public Object data(String code) {
////		stockHistoryService.handleHisory();
//		return "success";
//	}
//
//	@RequestMapping("/data")
//	public Object data(@RequestBody JSONObject data) {
//		int type = data.getIntValue("type");
//		String remark = data.getString("remark");
//		JSONArray array = data.getJSONObject("data").getJSONArray("diff");
//
//		log.info("array->{}", array.size());
//		List<StockCode> list = new ArrayList<>();
//		for (int i = 0; i < array.size(); i++) {
//			JSONObject json = array.getJSONObject(i);
//			String f12 = json.getString("f12");
//			String f14 = json.getString("f14");
//			StockCode e = new StockCode();
//			e.setCode(f12);
//			e.setName(f14);
//			e.setType(type);
//			e.setRemark(remark);
//			list.add(e);
//		}
//		list = list.stream().sorted((s1, s2) -> Long.parseLong(s1.getCode()) > Long.parseLong(s2.getCode()) ? 1 : -1)
//				.collect(Collectors.toList());
//		stockCodeService.save(list);
//		return list;
//	}
//}
